﻿using System;
using System.Reflection;

namespace XData.Common.Fast
{
    internal interface IFastHelper
    {
        Func<object[], T> CreateCreatorHandler<T>(ConstructorInfo constructorInfo);
        Func<T, TValue> CreateGetterHandler<T, TValue>(PropertyInfo propertyInfo);
        Action<T, TValue> CreateSetterHandler<T, TValue>(PropertyInfo propertyInfo);
        Func<TValue> CreateStaticGetterHandler<TValue>(PropertyInfo propertyInfo);
        Action<TValue> CreateStaticSetterHandler<TValue>(PropertyInfo propertyInfo);
        Func<T, TValue> CreateGetterHandler<T, TValue>(FieldInfo fieldInfo);
        Action<T, TValue> CreateSetterHandler<T, TValue>(FieldInfo fieldInfo);
        Func<TValue> CreateStaticGetterHandler<TValue>(FieldInfo fieldInfo);
        Action<TValue> CreateStaticSetterHandler<TValue>(FieldInfo fieldInfo);
    }

    internal static class FastHelper
    {
        public static IFastHelper Instance { get; } = new EmitHelper();
    }
}